const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const ObjectId = Schema.Types.ObjectId;
//用户装备背包表
const UserEquipmentsSchema = new Schema({
    user: {//用户
        type: ObjectId,
        ref: "users"
    },
    equipment: {//物品
        type: ObjectId,
        ref: "equipments"
    },
    price_type: {
        type: Number, //0金币 1钻石
        default: 0
    },
    price: {
        type: Number,
        default: 0
    },
    skill: {
        type: ObjectId,
        ref: "skills"
    },
    // 加成相关
    strength: {// 力量属性
        type: Number,
        default: 0
    }, 
    defense: {// 体质属性
        type: Number,
        default: 0
    },
    magic: {// 灵力属性
        type: Number,
        default: 0
    },
    speed: { // 速度属性
        type: Number,
        default: 0
    },
    accuracy:{ // 命中率
        type: Number,
        required: true,
        default: 0
    },
    status: { //状态 0未装备 1已装备
        type: Number,
        default: 0
    },
    created_at: {
        type: Date,
        default: new Date()
    }
});



module.exports = User_Equipment = mongoose.model("userequipments", UserEquipmentsSchema);